<template>
	<view class="container">
		<view class="bg"><image :src="service.service_background"></image></view>
		<view class="introduction">
			<view class="title">
				{{service.title}}
			</view>
			<view class="price">
				<span style="font-size: 24rpx;margin-right: -10rpx;">￥</span>
				{{service.price}}
				<span style="font-size: 28rpx;margin-left: -10rpx;">/次</span>
				<span style="font-size: 24rpx;">起</span>
			</view>
		</view>
		<view class="fuwu">
			<image style="width: 38rpx;height: 38rpx;margin-right: 10rpx;" src="../../static/feed/checkbox.png"></image>
			服务全程录像
		</view>
		<view class="detail">
			<view class="tablist">
				<view @click="changTab(0)" :class="['tab',tab===0?'active':'']">服务介绍</view>
				<view @click="changTab(1)" :class="['tab',tab===1?'active':'']">服务评价</view>
			</view>
			<view v-if="tab===0" class="longpicture">
				<image :src="service.service_introduction"></image>
			</view>
			<view v-if="tab===1" style="width: 100%;">
				<Pingjia type="service" service_id="1"></Pingjia>
			</view>
		</view>
		<view style="width: 100%;height: 120rpx;"></view>
		<view class="bottom">
			<view @click="goConfirm()" class="button">立即预定</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import {ref,reactive,onBeforeMount} from "vue"
	import Pingjia from "./components/Pingjia.vue"
	import http from "@/utils/request.js"
	onBeforeMount(()=>{
		getservice()
	})
	
	let service=ref({})
	let price=ref(70)
	let tab=ref(0)
	
	function goConfirm(){
		uni.navigateTo({
			url:"/pages/feed/confirm"
		})
	}
	function changTab(e){
		tab.value=e;
	}
	function getservice(){
		let response=http.get('/service/getservice',{service_id:1})
		response.then(res=>{
			if(res.data.code===200){
				service.value=res.data.data
			}
		})
	}
	
</script>

<style lang="scss">
	.container{
		display: flex;
		flex-direction: column;
		justify-content: center;
		
		.bg{
			width: 100%;
			height: 430rpx;
			
			image{
				width: 100%;
				height: 100%;
			}
		}
		
		.introduction{
			width: 100%;
			background-color: #ffffff;
			padding: 20rpx;
			
			.title{
				font-size: 32rpx;
				font-weight: 600;
				margin-bottom: 20rpx;
			}
			
			.price{
				color:#cc6278;
				font-size: 32rpx;
			}
		}
		
		.fuwu{
			width: 100%;
			padding: 20rpx;
			display: flex;
			align-items: center;
			color:#96959b;
			font-size: 28rpx;
			letter-spacing: 0.1em;
		}
		
		.detail{
			width: 100%;
			background-color: #ffffff;
			box-sizing: border-box;
			padding: 20rpx;
			
			.title{
				width: 100%;
				display: flex;
				justify-content: center;
				margin-bottom: 20rpx;
				font-size: 32rpx;
				font-weight: 700;
			}
			
			.longpicture{
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: center;
				
				image{
					width: 90%;
					height: 1000rpx;
				}
			}
		}
		
		.bottom{
			position: fixed;
			box-shadow: 0 -12rpx 64rpx -14rpx rgba(0, 0, 0, 0.15);
			bottom: 0;
			width: 100%;
			height: 120rpx;
			background-color: #ffffff;
			border-radius:20rpx 20rpx 0 0 ;
			display: flex;
			align-items: center;
			justify-content: center;
			
			.button{
				background-color: #f8e177;
				display: flex;
				align-items: center;
				justify-content: center;
				color: #090300;
				letter-spacing: 0.2em;
				width: 90%;
				height: 70%;
				border-radius: 50rpx;
				
				&:active{
					opacity: 0.7;
				}
			}
		}
	}
	
	.tablist{
		width: 100%;
		padding: 20rpx 0;
		display: flex;
		align-items: center;
		margin-bottom: 20rpx;
		justify-content: center;
		
		.tab{
			font-size: 36rpx;
			margin-right: 40rpx;
			color: #626669;
			
			&.active{
				color:#000000;
				position: relative;
				font-weight: 600;
				
				&::after{
					content: '';
					position: absolute;
					border-radius: 40rpx;
					width: 120rpx;
					height: 10rpx;
					background: linear-gradient(80deg,#f8e177 49.5%,transparent 49.5%,#fae68d 49.5%);
					bottom: -20rpx;
					right: 50%;
					transform:translateX(50%) ;
				}
			}
		}
	}
</style>
